<?php

namespace app\admin\controller;

use app\service\ArrivalreminderService;

/**
 * 到货提醒管理
 * @author   csb 
 * @version  0.0.1
 * @datetime 2016-12-01T21:51:08+0800
 */
class Arrivalreminder extends Common {
       
    /**
     * 构造方法
     * @author   Devil
     * @blog     http://gong.gg/
     * @version  0.0.1
     * @datetime 2016-12-03T12:39:08+0800
     */
    public function __construct() {
        // 调用父类前置方法
        parent::__construct();

        // 登录校验
        $this->IsLogin();

        // 权限校验
        $this->IsPower();
    }

    /**
     * [Index 书单列表]
     * @author   Devil
     * @blog     http://gong.gg/
     * @version  0.0.1
     * @datetime 2016-12-06T21:31:53+0800
     */
    public function Index() {

        // 参数
        $params = input();
        $where = ArrivalreminderService::ArrivalreminderWhere($params);
        // 总数
        $total = ArrivalreminderService::ArrivalreminderTotal();

        // 分页
        $number = MyC('admin_page_number', 10, true);
        $page_params = array(
            'number' => $number,
            'total' => $total,
            'where'=>$params,
            'page' => isset($params['page']) ? intval($params['page']) : 1,
            'url' => MyUrl('admin/ArrivalReminder/index'),
        );
        $page = new \base\Page($page_params);

        // 获取数据列表
        $data_params = [
            'where'=> $where,
            'm' => $page->GetPageStarNumber(),
            'n' => $number
        ];
        $ret = ArrivalreminderService::ArrivalreminderList($data_params);
        $this->assign('params', $params);
        $this->assign('page_html', $page->GetPageHtml());
        $this->assign('data_list', $ret['data']);
        return $this->fetch();
    }

    /**
     * @author 提醒状态更新
     * @blog     http://gong.gg/
     * @version  0.0.1
     * @datetime 2016-12-06T21:31:53+0800
     */
    public function statusShelves() {
        // 是否ajax   单条删除
        
                // 开始操作
            $params = input('post.');
            $params['field']= "status";
            $params['state']= 1;
            return ArrivalreminderService::changeStatus($params);
     
    }

}

?>